
/**
 * @module clientInfo
 * @author: HJava
 * @description: 用于获取当前操作系统和容器相关信息
 * @since: 2021-01-04 21:45:44
 */
Object.defineProperty(exports, "__esModule", { value: true });
var UA_REG = {
    iOS: /(iphone|ipad)/i,
    Win: /windows nt/i,
    Android: /android/i,
    Mac: /mac os x/i,
    Linux: /linux/i,
};
var ClientInfo = /** @class */ (function () {
    function ClientInfo() {
    }
    ClientInfo.prototype.getClientInfo = function () {
        if (true) {
            return this._getClientInfo();
        }
        if (false) {}
        return {
            os: 'Mac',
            pt: 4,
            ren: '',
            rev: '',
        };
    };
    ClientInfo.prototype._getClientInfo = function () {
        var ua = window.navigator.userAgent;
        var deviceInfo = {
            os: '',
            pt: '',
            ren: '',
            rev: '',
        };
        var recordVersion;
        for (var device in UA_REG) {
            if (UA_REG[device].test(ua)) {
                deviceInfo['os'] = device;
                deviceInfo['pt'] = ['iOS', 'Android'].indexOf(device) === -1 ? 'web' : device;
                break;
            }
        }
        if ((recordVersion = ua.match(/msie ([\d.]+)/i)) && !/opera/i.test(ua)) {
            deviceInfo.ren = 'IE';
        }
        else if ((recordVersion = ua.match(/firefox\/([\d.]+)/i))) {
            deviceInfo.ren = 'Firefox';
        }
        else if ((recordVersion = ua.match(/chrome\/([\d.]+)/i)) && /webkit/i.test(ua) && /mozilla/i.test(ua)) {
            deviceInfo.ren = 'Chrome';
        }
        else if ((recordVersion = ua.match(/opera.([\d.]+)/))) {
            deviceInfo.ren = 'Opera';
        }
        else if (/webkit/i.test(ua) &&
            !(/chrome/i.test(ua) && /webkit/i.test(ua) && /mozilla/i.test(ua)) &&
            (recordVersion = ua.match(/version\/([\d.]+).*safari/i))) {
            deviceInfo.ren = 'Safari';
        }
        else {
            deviceInfo.ren = 'Other';
        }
        deviceInfo.rev = recordVersion ? recordVersion[1] : '';
        return deviceInfo;
    };
    return ClientInfo;
}());
exports.default = new ClientInfo();


//# sourceURL=webpack://MTDX/./src/core/utils/clientInfo.ts?